package main

import (
	"fmt"
	"strconv"
)

func easy() {
	sum := 0
	for i := 1; i <= 100; i++ {
		sum += 1
	}
	fmt.Println(sum)
}

func convertTobin(n int) string {
	result := ""
	// 因为N/=2其实是N=N/2,而你的N是int 型，编译器会自动将不是整型数，转换为整型，19.5放到N中也就是19了
	for ; n > 0; n /= 2 {
		lsb := n % 2
		// int转字符串
		result = strconv.Itoa(lsb) + result
	}
	return result
}

func main() {
	fmt.Println(
		convertTobin(23), //10111
		//convertTobin(13),1*2^0 + 1*2^1 + 1*2^2 + 0*2^3 + 1*2^4 = 1+2+4+0+16

	)
}
